package au.edu.unsw.infs3634.gamifiedlearning;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import org.litepal.LitePal;

import java.util.ArrayList;
import java.util.List;

import au.edu.unsw.infs3634.gamifiedlearning.adapter.HistoryMeetingAdapter;
import au.edu.unsw.infs3634.gamifiedlearning.adapter.SendAdapter;
import au.edu.unsw.infs3634.gamifiedlearning.model.HistoryMeetingListModel;
import au.edu.unsw.infs3634.gamifiedlearning.model.SendModel;

public class Video_list extends AppCompatActivity {

    private List<HistoryMeetingListModel> historyMeetingListModelList = new ArrayList<HistoryMeetingListModel>();
    private HistoryMeetingAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_list);

        // Back button
        assert getSupportActionBar() != null;
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        setTitle("视频会商");

        adapter = new HistoryMeetingAdapter(LitePal.findAll(HistoryMeetingListModel.class));
        RecyclerView recyclerView = findViewById(R.id.historyList);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(linearLayoutManager);

        recyclerView.setAdapter(adapter);


        View send = findViewById(R.id.send);
        View join = findViewById(R.id.join);
        View appoint = findViewById(R.id.appoint);
        // 跳到发起会议界面
        send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(view.getContext(), SendList.class);
                startActivity(intent);
            }
        });
        // 跳到加入会议界面
        join.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(view.getContext(), JoinList.class);
                startActivity(intent);
            }
        });
        // 跳到加入预约界面
        appoint.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(view.getContext(), AppointMeeting.class);
                startActivity(intent);
            }
        });
    }





    //Back button
    @Override
    public boolean onSupportNavigateUp() {
        finish();
        return true;
    }


}